package com.umfwechat.util;

/**
 * 日账单/结算文件的路径是根据时间动态产生的
 * @author haiTangZ
 *
 */
public class TimePathUtil {
	
	/**
	 * 带有excel目录的时间路径，时间是指定时间
	 * @return
	 */
	public static String getTimePathWithXls(String date8, File task){
		return getTimePath(date8, task.xls, task.detailDir);
	}
	
	/**
	 * 带有txt目录的时间路径，时间是指定时间
	 * @return
	 */
	public static String getTimePathWithTxt(String date8, File task){
		return getTimePath(date8, task.txt, task.detailDir);
	}
	
	/**
	 * 获取带有时间的新格式的路径
	 * /usr/mpsp/duizhang/mer3/newDailyBillDetail/date8/cls/
	 * /usr/mpsp/duizhang/mer3/newDailyBillDetail/20160501/excel/
	 * @param date8
	 * @param cls
	 * @return
	 */
	private static String getTimePath(String date8, String cls, String dir){
		// 拼接路径
		String path = dir.replace("{yyyyMMdd}", date8).replace("{cls}", cls) + "/";
		return path;
	}
	
	/**
	 * 获取文件路径  日账单/结算文件
	 * @param task
	 * @return
	 */
	public static String getPath(File task){
		return task.uploadDir + java.io.File.separator;
	}
	
	
	/** 日账单excel的目录名 */
	public final static String DAIL_BILL_XLS = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "dailybill.xls.dir");
	/** 日账单txt的目录名 */
	public final static String DAIL_BILL_TXT = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "dailybill.txt.dir");
	/** 日账单的生成目录 */
	public final static String DAIL_BILL_DETAIL_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "dailybill.dailybillInDetail.path");
	/** 日账单的上传目录 */
	public final static String DAIL_BILL_UPLOAD_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "batch.dailyBillSum.url");
	/** 结算文件excel的目录名 */
	public final static String SETTLE_XLS = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "settle.xls.dir");
	/** 结算文件txt的目录名 */
	public final static String SETTLE_TXT = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "settle.txt.dir");
	/** 结算文件的生成目录 */
	public final static String SETTLE_DETAIL_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "settle.settleInDetail.path");
	/** 结算文件的上传目录 */
	public final static String SETTLE_UPLOAD_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "batch.settleSum.url");
	
	/** 日账单手续费账户nas的绝对路径 */
	public final static String DAILY_BILL_ACCNAS_COMAMT_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "dailybill.dailybillInDetail.accnas.comamt.path");
	/** 日账单现金账户nas的绝对路径 */
	public final static String DAILY_BILL_ACCNAS_CASH_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "dailybill.dailybillInDetail.accnas.cash.path");
	/** 日账单过渡账户nas的绝对路径 */
	public final static String DAILY_BILL_ACCNAS_TRANSITION_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "dailybill.dailybillInDetail.accnas.transition.path");
	/** 结算文件nas的绝对路径 */
	public final static String SETTLE_SETTNAS_DIR = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "settle.settleInDetail.settnas.path");
																			  
	/** 跨境结算文件取购汇明细文件路径 */
	public final static String CB_DETAILED_PATH = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "cb.parse.dir");
	/** 跨境结算文件excel文件路径 */
	public final static String CB_EXCEL_PATH = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "cb.parse.excelDir");
	/** 跨境结算文件取账户组文件路径 */
	public final static String CB_SETTLE_PATH = PropertyUtil.getStrValue("umfWeChatPlat_appConf.properties", "cb.parse.settleDir");
	
	
	/**
	 * 有两种文件类型:
	 * 日账单、结算文件
	 * @author haiTangZ
	 *
	 */
	public enum File{
		
		DAILY(DAIL_BILL_UPLOAD_DIR, DAIL_BILL_XLS, DAIL_BILL_TXT, DAIL_BILL_DETAIL_DIR)
		,SETTLE(SETTLE_UPLOAD_DIR, SETTLE_XLS, SETTLE_TXT, SETTLE_DETAIL_DIR)
		;
		
		private String uploadDir;
		private String xls;
		private String txt;
		private String detailDir;
		
		
		/** 企业版日账单或者结算文件路径 */
		private File(String uploadDir, String xls, String txt, String detailDir){
			this.uploadDir = uploadDir;
			this.xls = xls;
			this.txt = txt;
			this.detailDir = detailDir;
		}
		
	}
	
	/**
	 * 账户/清结算的日账单或者结算文件的nas文件
	 * @author haiTangZ
	 *
	 */
	public enum NasFile{
		
		ACCCOM(DAILY_BILL_ACCNAS_COMAMT_DIR)
		,ACCCASH(DAILY_BILL_ACCNAS_CASH_DIR)
		,ACCTRANSITION(DAILY_BILL_ACCNAS_TRANSITION_DIR)
		,SETT(SETTLE_SETTNAS_DIR)
		,CBPATH(CB_DETAILED_PATH)
		,CBEXCELPATH(CB_EXCEL_PATH)
		,CBSETTLEPATH(CB_SETTLE_PATH)
		;
		
		private String dir;
		
		
		/** (账户或者清结算)nas路径 */
		private NasFile(String dir){
			this.dir = dir;
		}
	}
}